<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import ClosedGridBase from './closed-grid-grid-base.vue';
import AppCenterService from "@service/app/app-center-service";

 
@Component({
    components: {
         
    }
})
export default class ClosedGrid extends ClosedGridBase {


    /**
     * 重写执行created后的逻辑
     *
     *  @memberof ClosedGridBase
     */    
    public afterCreated(){
        this.setColState();
        if (this.viewState) {
            this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
                if (!Object.is(tag, this.name)) {
                    return;
                }
                if (Object.is('load', action)) {
                    this.load(data,true);
                }
                if (Object.is('remove', action)) {
                    this.remove(data);
                }
                if (Object.is('save', action)) {
                    this.save(data);
                }
            });
        }
        if(AppCenterService && AppCenterService.getMessageCenter()){
            this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
                if(!Object.is(name,"Task")){
                    return;
                }
                if(Object.is(action,'appRefresh')){
                    this.refresh([data]);
                }
            })
        }
    }
}
</script>